home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
utils
/
gemfsc15.lzh
/
AESSRC14.LZH
/
AESUTRS1.S
< prev
next >
Wrap
Text File
|
1990-05-26
|
3KB
|
85 lines
;*========================================================================
;*
;* AESFAST Public Domain GEM bindings.
;*
;*========================================================================
;*************************************************************************
;*
;* AESUTRS1.S - Resource-related Utilities 1 of 3.
;* Non-standard utility functions.
;*
;* 05/26/90 - v1.4
;* Added handling of ICON objects.
;* 08/28/89 - v1.3
;* Changed logic to assume a normal object then look for TEXT
;* type objects, instead of assuming TEXT then looking for
;* STRING or BUTTON objects. This effectively increases the
;* functionality of this routine: now it can be used to set
;* ob_spec values in general, and not just string pointers.
;* Also changed logic to check for INDIRECT flag and handle it.
;* (1.3b bug discovered in beta testing has been fixed: a move
;* was changed to lea, below).
;*************************************************************************
.include "gemfast.sh"
;-------------------------------------------------------------------------
; rsc_sstrings - Set pointers to strings within a tree.
; This function sets one or more string pointers within a
; resource tree. It knows the difference between strings
; and buttons and text objects, and sets the ob_spec or
; te_ptext pointer as appropriate. It accepts a variable
; number of object/pointer pairs, with a negative object
; index indicating the end of the list.
;
; void rsc_sstrings(tree, obj1,ptr1 [,obj2,ptr2,...,objn,ptrn], -1);
;-------------------------------------------------------------------------
_rsc_sstrings::
.cargs #8,.ptree.l,.parms
move.l a2,-(sp) ; Save Laser C register.
move.l .ptree(sp),a2
lea .parms(sp),a1
.loop:
move.w (a1)+,d2 ; Get object number, if negative
bmi.s .done ; we hit the end of the list.
move.l (a1)+,d0 ; Get string pointer.
muls #OBJ_SIZ,d2 ; Turn object number into index.
lea ob_spec(a2,d2.l),a0 ; Get ob_spec.
btst.b #0,ob_flags(a2,d2.l); Is INDIRECT flag set?
beq.s .notind ; Nope, ob_spec is all set.
move.l (a0),a0 ; Yep, get real ob_spec.
.notind:
move.w ob_type(a2,d2.l),d1 ; Get ob_type.
cmp.b #G_ICON,d1
beq.s .icon
cmp.b #G_TEXT,d1
beq.s .text
cmp.b #G_BOXTEXT,d1
beq.s .text
cmp.b #G_FTEXT,d1
beq.s .text
cmp.b #G_FBOXTEXT,d1
bne.s .string
.icon:
move.l (a0),a0 ; For icon, ob_spec points to
lea 12(a0),a0 ; iconblk, text ptr is at iconblk+12.
bra.s .string
.text:
move.l (a0),a0 ; For text, ob_spec points to ptr.
.string:
move.l d0,(a0) ; Store string pointer.
bra.s .loop
.done:
move.l (sp)+,a2 ; Restore Laser C register.
rts
; end of code